package org.example.myportfolio.controller;


import lombok.extern.slf4j.Slf4j;
import org.example.myportfolio.config.response.JsonResult;
import org.example.myportfolio.service.TagService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;

@RestController
@Slf4j
@Validated
@RequestMapping("/api/v1/Tags")
public class TagController {

    @Autowired
    private TagService tagService;


    @PostMapping("addTag")
    public JsonResult createTag(@RequestParam("name") String tagName) {
        log.info("createTag: {}", tagName);
        tagService.createTag(tagName);
        return JsonResult.ok();
    }




}
